package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.Reservation;
import com.zzyl.vo.ReservationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface CustomerReservationMapper {
    Integer getCancelledCount(LocalDateTime begin, LocalDateTime end, Long userId);

    Integer getCancelledCountWithPhone(String mobile,LocalDateTime time);


    int getReservationCount(LocalDateTime startTime, LocalDateTime endTime);

    Page<ReservationVo> selectByPage(Integer pageNum, Integer pageSize, Long userId, Integer status);

    void addReservation(Reservation reservation);

    void cancelReservation(Long id, Integer status);

    @Select("select time from reservation where id = #{id}")
    LocalDateTime getReservationTime(Long id);

    @Select("select mobile from reservation where update_by = #{userId}")
    String getPhoneByUserId(Long userId);

    void autoCancelReservation(Long id, Integer status);
}
